In a sequence of positive integers each term after the first is $\frac{1}{3}$ of the sum of the term that precedes it and the term that follows it in the sequence. What is the 5th term of this sequence if the 1st term is 2 and the 4th term is 34?
Let $a,b,c$ be 2nd, 3rd, and 5th terms respectively. Our sequence is therefore $2,a,b,34,c,\dots$. From the information given, we have \begin{align*}
a &= \frac13(2+b)\\
b &= \frac13(a+34)\\
34 &= \frac13(b+c).
\end{align*} Before we find $c$, we use the first two equations to solve for $b$. Substituting $a = \frac13(2+b)$, we obtain \begin{align*}
b &= \frac13(\frac13(2+b)+34)\\
\Rightarrow 3b &= \frac13(2+b)+34\\
\Rightarrow 9b &= 2+b+102\\
\Rightarrow 8b &= 104\\
\Rightarrow b &= 13.
\end{align*} Substituting $b = 13$ into $34 = \frac13(b+c)$, we obtain \begin{align*}
34 &= \frac13(13+c)\\
\Rightarrow 102 &= 13+c\\
\Rightarrow c &= \boxed{89}.
\end{align*}